/*
 * Copyright (c) 2012-2020 MIRACL UK Ltd.
 *
 * This file is part of MIRACL Core
 * (see https://github.com/miracl/core).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

//
//  rom.swift
//
//  Created by Michael Scott on 12/06/2015.
//  Copyright (c) 2015 Michael Scott. All rights reserved.
//

import core

public struct ROM{
 
#if D32

// Base Bits= 28
// fp256bn Curve Modulus
static let Modulus:[Chunk] = [0xED33013,0x292DDBA,0x80A82D3,0x65FB129,0x49F0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF]
static let ROI:[Chunk] = [0xED33012,0x292DDBA,0x80A82D3,0x65FB129,0x49F0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF]
static let R2modp:[Chunk] = [0x3B9F8B,0xEDE3363,0xFEC54E8,0x92FFEE9,0x3C55F79,0x13C1C06,0xC0123FA,0xA12F2EA,0xE559B2A,0x8]
static let MConst:Chunk = 0x537E5E5
static let SQRTm3:[Chunk] = [0x78FC004,0xF119926,0x1B0451C,0xB6BF2F7,0x3D3D540,0xDDCA517,0xAD3D42F,0xFFFCF0C,0xFFFFFFF,0xF]

static let CURVE_Cof_I:Int = 1
static let CURVE_B_I:Int = 3
static public let CURVE_B:[Chunk] = [0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static public let CURVE_Order:[Chunk] = [0x10B500D,0x2D536CD,0x9921AF6,0x65FB129,0x49E0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF]
static public let CURVE_Gx:[Chunk] = [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static public let CURVE_Gy:[Chunk] = [0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static public let CURVE_HTPC:[Chunk] = [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static public let Fra:[Chunk] = [0xF943106,0x760328A,0xAB28F74,0x71511E3,0x7CF39A1,0x8DDB086,0x52D1A6E,0xCA786F3,0xD617662,0x3]
static public let Frb:[Chunk] = [0xF3EFF0D,0xB32AB2F,0xD57F35E,0xF4A9F45,0xCCFD33A,0xD113693,0x819CB83,0x3584819,0x29E899D,0xC]
static public let CURVE_Bnx:[Chunk] = [0xB0A801,0x82F5C03,0x68,0x0,0x0,0x0,0x0,0x0,0x0,0x0]
static public let CURVE_Cof:[Chunk] = [0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0] 
static public let CRu:[Chunk] = [0x3A1B807,0x1C0A24A,0x32D1EDB,0xD79DF19,0x8659BCD,0x4092101,0x13988E1,0x0,0x0,0x0]
static public let CURVE_Pxa:[Chunk] = [0x9C09EFB,0x2616B68,0xF843CD2,0x539A12B,0x13ACE1C,0x577C289,0x28560F,0xB4C96C2,0xE0C3350,0xF]
static public let CURVE_Pxb:[Chunk] = [0x37E6A2B,0x69ED34A,0x3589D2,0x78E287D,0x3B924DD,0xC637D81,0x4DB5AE1,0x738AC05,0xEA66057,0x4]
static public let CURVE_Pya:[Chunk] = [0xEDC27FF,0x9B481B,0x15848E9,0x24758D6,0xE51EFCB,0x75124E3,0x376770D,0xC542A3B,0x2046E7,0x7]
static public let CURVE_Pyb:[Chunk] = [0xAAD049B,0x1281114,0xA98B3E0,0xBE80821,0x29F8B4C,0x49297EB,0x42EEA6,0xD388C29,0x554E3BC,0x0]
static let CURVE_W:[[Chunk]] = [[0xB054003,0xF0036E1,0xE78663A,0xFFFFFFF,0xFFFF,0x0,0x0,0x0,0x0,0x0],[0x1615001,0x5EB806,0xD1,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]
static let CURVE_SB:[[[Chunk]]] = [[[0xC669004,0xF5EEEE7,0xE78670B,0xFFFFFFF,0xFFFF,0x0,0x0,0x0,0x0,0x0],[0x1615001,0x5EB806,0xD1,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x1615001,0x5EB806,0xD1,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x606100A,0x3D4FFEB,0xB19B4BB,0x65FB129,0x49D0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF]]]
static let CURVE_WB:[[Chunk]] = [[0xD30A800,0x20678F0,0x4D2CC10,0x5555555,0x5555,0x0,0x0,0x0,0x0,0x0],[0xD7DC805,0xD6764C0,0xBC3AD1A,0x8FBEA10,0x4467DE,0x8061601,0xD105EB,0x0,0x0,0x0],[0xF173803,0xACB6061,0x5E1D6C1,0x47DF508,0x82233EF,0xC030B00,0x6882F5,0x0,0x0,0x0],[0xE91F801,0x26530F6,0x4D2CCE1,0x5555555,0x5555,0x0,0x0,0x0,0x0,0x0]]
static let CURVE_BB:[[[Chunk]]] = [[[0x5AA80D,0xAA5DACA,0x9921A8D,0x65FB129,0x49E0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF],[0x5AA80C,0xAA5DACA,0x9921A8D,0x65FB129,0x49E0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF],[0x5AA80C,0xAA5DACA,0x9921A8D,0x65FB129,0x49E0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF],[0x1615002,0x5EB806,0xD1,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0x1615001,0x5EB806,0xD1,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x5AA80C,0xAA5DACA,0x9921A8D,0x65FB129,0x49E0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF],[0x5AA80D,0xAA5DACA,0x9921A8D,0x65FB129,0x49E0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF],[0x5AA80C,0xAA5DACA,0x9921A8D,0x65FB129,0x49E0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF]],[[0x1615002,0x5EB806,0xD1,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x1615001,0x5EB806,0xD1,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x1615001,0x5EB806,0xD1,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x1615001,0x5EB806,0xD1,0x0,0x0,0x0,0x0,0x0,0x0,0x0]],[[0xB0A802,0x82F5C03,0x68,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0x2C2A002,0xBD700C,0x1A2,0x0,0x0,0x0,0x0,0x0,0x0,0x0],[0xFAA000A,0x2767EC6,0x9921A25,0x65FB129,0x49E0CDC,0x5EEE71A,0xD46E5F2,0xFFFCF0C,0xFFFFFFF,0xF],[0xB0A802,0x82F5C03,0x68,0x0,0x0,0x0,0x0,0x0,0x0,0x0]]]



#endif

#if D64

// Base Bits= 56
static let Modulus:[Chunk] = [0x292DDBAED33013,0x65FB12980A82D3,0x5EEE71A49F0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF]
static let ROI:[Chunk] = [0x292DDBAED33012,0x65FB12980A82D3,0x5EEE71A49F0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF]
static let R2modp:[Chunk] = [0xEDE336303B9F8B,0x92FFEE9FEC54E8,0x13C1C063C55F79,0xA12F2EAC0123FA,0x8E559B2A]
static let MConst:Chunk = 0x6C964E0537E5E5
static let SQRTm3:[Chunk] = [0xF11992678FC004,0xB6BF2F71B0451C,0xDDCA5173D3D540,0xFFFCF0CAD3D42F,0xFFFFFFFF]

static let CURVE_Cof_I:Int = 1
static let CURVE_B_I:Int = 3
static public let CURVE_B:[Chunk] = [0x3,0x0,0x0,0x0,0x0]
static public let CURVE_Order:[Chunk] = [0x2D536CD10B500D,0x65FB1299921AF6,0x5EEE71A49E0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF]
static public let CURVE_Gx:[Chunk] = [0x1,0x0,0x0,0x0,0x0]
static public let CURVE_Gy:[Chunk] = [0x2,0x0,0x0,0x0,0x0]
static public let CURVE_HTPC:[Chunk] = [0x1,0x0,0x0,0x0,0x0]
static public let Fra:[Chunk] = [0x760328AF943106,0x71511E3AB28F74,0x8DDB0867CF39A1,0xCA786F352D1A6E,0x3D617662]
static public let Frb:[Chunk] = [0xB32AB2FF3EFF0D,0xF4A9F45D57F35E,0xD113693CCFD33A,0x3584819819CB83,0xC29E899D]
static public let CURVE_Bnx:[Chunk] = [0x82F5C030B0A801,0x68,0x0,0x0,0x0]
static public let CURVE_Cof:[Chunk] = [0x1,0x0,0x0,0x0,0x0]
static public let CRu:[Chunk] = [0x1C0A24A3A1B807,0xD79DF1932D1EDB,0x40921018659BCD,0x13988E1,0x0]
static public let CURVE_Pxa:[Chunk] = [0x2616B689C09EFB,0x539A12BF843CD2,0x577C28913ACE1C,0xB4C96C2028560F,0xFE0C3350]
static public let CURVE_Pxb:[Chunk] = [0x69ED34A37E6A2B,0x78E287D03589D2,0xC637D813B924DD,0x738AC054DB5AE1,0x4EA66057]
static public let CURVE_Pya:[Chunk] = [0x9B481BEDC27FF,0x24758D615848E9,0x75124E3E51EFCB,0xC542A3B376770D,0x702046E7]
static public let CURVE_Pyb:[Chunk] = [0x1281114AAD049B,0xBE80821A98B3E0,0x49297EB29F8B4C,0xD388C29042EEA6,0x554E3BC]
static let CURVE_W:[[Chunk]] = [[0xF0036E1B054003,0xFFFFFFFE78663A,0xFFFF,0x0,0x0],[0x5EB8061615001,0xD1,0x0,0x0,0x0]]
static let CURVE_SB:[[[Chunk]]] = [[[0xF5EEEE7C669004,0xFFFFFFFE78670B,0xFFFF,0x0,0x0],[0x5EB8061615001,0xD1,0x0,0x0,0x0]],[[0x5EB8061615001,0xD1,0x0,0x0,0x0],[0x3D4FFEB606100A,0x65FB129B19B4BB,0x5EEE71A49D0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF]]]
static let CURVE_WB:[[Chunk]] = [[0x20678F0D30A800,0x55555554D2CC10,0x5555,0x0,0x0],[0xD6764C0D7DC805,0x8FBEA10BC3AD1A,0x806160104467DE,0xD105EB,0x0],[0xACB6061F173803,0x47DF5085E1D6C1,0xC030B0082233EF,0x6882F5,0x0],[0x26530F6E91F801,0x55555554D2CCE1,0x5555,0x0,0x0]]
static let CURVE_BB:[[[Chunk]]] = [[[0xAA5DACA05AA80D,0x65FB1299921A8D,0x5EEE71A49E0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF],[0xAA5DACA05AA80C,0x65FB1299921A8D,0x5EEE71A49E0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF],[0xAA5DACA05AA80C,0x65FB1299921A8D,0x5EEE71A49E0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF],[0x5EB8061615002,0xD1,0x0,0x0,0x0]],[[0x5EB8061615001,0xD1,0x0,0x0,0x0],[0xAA5DACA05AA80C,0x65FB1299921A8D,0x5EEE71A49E0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF],[0xAA5DACA05AA80D,0x65FB1299921A8D,0x5EEE71A49E0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF],[0xAA5DACA05AA80C,0x65FB1299921A8D,0x5EEE71A49E0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF]],[[0x5EB8061615002,0xD1,0x0,0x0,0x0],[0x5EB8061615001,0xD1,0x0,0x0,0x0],[0x5EB8061615001,0xD1,0x0,0x0,0x0],[0x5EB8061615001,0xD1,0x0,0x0,0x0]],[[0x82F5C030B0A802,0x68,0x0,0x0,0x0],[0xBD700C2C2A002,0x1A2,0x0,0x0,0x0],[0x2767EC6FAA000A,0x65FB1299921A25,0x5EEE71A49E0CDC,0xFFFCF0CD46E5F2,0xFFFFFFFF],[0x82F5C030B0A802,0x68,0x0,0x0,0x0]]]

#endif


}

